﻿component output="false" accessors="true" {
	
	property name="key" type="String";
	property name="keyAlgorithm" type="String";
	property name="cryptAlgorithm" type="String";
	property name="cryptEncoding" type="String";
	
	public String function encryptString( required String value ){
		
		return encrypt( arguments.value, createKey(), getCryptAlgorithm(), getCryptEncoding() );
	}
	
	public String function decryptString( required String value ){
		
		return decrypt( arguments.value, createKey(), getCryptAlgorithm(), getCryptEncoding() );
	}

	private String function createKey(){
		
		return hash( getKey(), getKeyAlgorithm() );		
	}
	
}
